package logic

import (
	"context"
	"go.uber.org/zap"
	"order_srv/internal/dao"
	"order_srv/internal/svc"
	"order_srv/order"
	"smart-health-platforms/pkg"

	"github.com/zeromicro/go-zero/core/logx"
)

type InvoicePDFLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewInvoicePDFLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InvoicePDFLogic {
	return &InvoicePDFLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 发票生成
func (l *InvoicePDFLogic) InvoicePDF(in *order.InvoicePDFRequest) (*order.InvoicePDFResponse, error) {
	//业务逻辑
	invoice, err := dao.InvoicePDF(in)
	if err != nil {
		pkg.Error("生成发票失败", zap.Error(err))
		return nil, err
	}
	return &order.InvoicePDFResponse{
		Message: invoice,
	}, nil
}
